<?php
namespace Admin\Controller;
use Think\Controller;
class UsersController extends Controller
{
    /*1.用户列表*/
    public function userlist(){
        $userModel=M('users');//表明,conf中定义前缀
        $user=$userModel->order('user_id asc')->select(); //desc降序 asc升序

        //dump($sport);
        $this->user=$user;//name属性对应的值 $this->对应值=$sport;
            
        $this->display();
     
    }


/*2.查看用户详情*/
public function detailuser(){
        $id=I('id');
        $user = M('users');
        $this->userinfo=$user->where("user_id=$id")->find();
        $this->display();
    }

 /*3.删除用户*/
    public function deluser()
    {
        $id=I('id');
        $usersModel = M('users');
        $user=$usersModel->where("user_id=$id")->find();
        unlink(realpath("./Public/Uploads/logo/".$user["photo"]));
        if($usersModel->delete($id)) {
            $this->success('删除成功');
        }
        else {
            $this->error('删除失败');
        }
    }

}